    function init() {

        //新建点矢量图层
        pointLayer = new SuperMap.Layer.Vector("pointLayer");

        //新建线矢量图层
        lineLayer = new SuperMap.Layer.Vector("lineLayer");

        //新建面矢量图层
        polygonLayer = new SuperMap.Layer.Vector("polygonLayer");

        pointLayer.style = styleGuidePoint;

        //对线图层应用样式style（前面有定义）
        lineLayer.style = style;

        //对面图层应用样式style
        polygonLayer.style = style;

        //创建点线控制，图层是lineLayer;这里DrawFeature(图层,类型,属性)；multi:true在将要素放入图层之前是否现将其放入几何图层中
        drawPoint = new SuperMap.Control.DrawFeature(pointLayer, SuperMap.Handler.Point, {
            multi: true
        });

        //创建画线控制，图层是lineLayer;这里DrawFeature(图层,类型,属性)；multi:true在将要素放入图层之前是否现将其放入几何图层中
        drawLine = new SuperMap.Control.DrawFeature(lineLayer, SuperMap.Handler.Path, {
            multi: true
        });

        //创建面线控制，图层是lineLayer;这里DrawFeature(图层,类型,属性)；multi:true在将要素放入图层之前是否现将其放入几何图层中
        drawPolygon = new SuperMap.Control.DrawFeature(polygonLayer, SuperMap.Handler.Polygon);

        /*
        注册featureadded事件,触发drawCompleted()方法
        例如注册"loadstart"事件的单独监听
        events.on({ "loadstart": loadStartListener });
        */
        //*定义layer图层，TiledDynamicRESTLayer：分块动态 REST 图层
        layer = new SuperMap.Layer.TiledDynamicRESTLayer("China", url, {
            transparent: true,
            cacheEnabled: true
        }, {
            maxResolution: "auto"
        });
        //为图层初始化完毕添加addLayer()事件
        layer.events.on({
            "layerInitialized": addLayer
        });
        map = new SuperMap.Map("map", {
            controls: [
                // new SuperMap.Control.LayerSwitcher(),
                new SuperMap.Control.Navigation({
                    dragPanOptions: {
                        enableKinetic: true
                    }
                }),
                drawPoint, drawLine, drawPolygon
            ]
        });
        //初始化简易缩放控件类
        zoom = new SuperMap.Control.Zoom();
        //加载平移缩放控件
        map.addControl(new SuperMap.Control.PanZoomBar(), new SuperMap.Pixel(0, 400));
        //加载比例尺控件
        map.addControl(new SuperMap.Control.ScaleLine(), new SuperMap.Pixel(25, 550));
        //加载地图鹰眼控件
        map.addControl(new SuperMap.Control.OverviewMap(), new SuperMap.Pixel(300, 300));
        //加载地图图层切换控件
        map.addControl(new SuperMap.Control.LayerSwitcher(), new SuperMap.Pixel(60, 370));
    }

    function addLayer() {
        map.addLayers([layer, pointLayer, lineLayer, polygonLayer]);
        map.setCenter(new SuperMap.LonLat(5105, -3375), 2);
    }

    function draw_point() {
        pointLayer.removeAllFeatures(marker);
        drawPoint.activate();
        var size = new SuperMap.Size(44, 33);
        var offset = new SuperMap.Pixel(-(size.w / 2), -size.h);
        var icon = new SuperMap.Icon('../cchunGIS/image/mjg/marker.png', size, offset);
    }

    function distanceMeasure() {
        lineLayer.removeAllFeatures();
        drawLine.activate();
        drawLine.events.on({
            "featureadded": drawCompleted1
        });
    }

    function draw_polygon() {
        polygonLayer.removeAllFeatures();
        drawPolygon.activate();
        drawPolygon.events.on({
            "featureadded": drawCompleted2
        })
    }

    //绘完触发事件
    function drawCompleted1(drawGeometryArgs) {
        //停止画面控制
        drawLine.deactivate();
        //获得图层几何对象
        var geometry = drawGeometryArgs.feature.geometry,
            measureParam = new SuperMap.REST.MeasureParameters(geometry),
            /* MeasureParameters：量算参数类。 客户端要量算的地物间的距离或某个区域的面积*/
            myMeasuerService = new SuperMap.REST.MeasureService(url); //量算服务类，该类负责将量算参数传递到服务端，并获取服务端返回的量算结果
        myMeasuerService.events.on({
            "processCompleted": measureCompleted1
        });

        //对MeasureService类型进行判断和赋值，当判断出是LineString时设置MeasureMode.DISTANCE，否则是MeasureMode.AREA

        myMeasuerService.measureMode = SuperMap.REST.MeasureMode.DISTANCE;

        myMeasuerService.processAsync(measureParam); //processAsync负责将客户端的量算参数传递到服务端。
    }

    //绘完触发事件
    function drawCompleted2(drawGeometryArgs) {
        //停止画面控制

        drawPolygon.deactivate();
        //获得图层几何对象
        var geometry = drawGeometryArgs.feature.geometry,
            measureParam = new SuperMap.REST.MeasureParameters(geometry),
            /* MeasureParameters：量算参数类。 客户端要量算的地物间的距离或某个区域的面积*/
            myMeasuerService = new SuperMap.REST.MeasureService(url); //量算服务类，该类负责将量算参数传递到服务端，并获取服务端返回的量算结果
        myMeasuerService.events.on({
            "processCompleted": measureCompleted2
        });

        //对MeasureService类型进行判断和赋值，当判断出是LineString时设置MeasureMode.DISTANCE，否则是MeasureMode.AREA

        myMeasuerService.measureMode = SuperMap.REST.MeasureMode.AREA;

        myMeasuerService.processAsync(measureParam); //processAsync负责将客户端的量算参数传递到服务端。
    }

    //测量结束调用事件
    function measureCompleted1(measureEventArgs) {
        var distance = measureEventArgs.result.distance;
        var unit = measureEventArgs.result.unit;
        alert("量算结果:" + distance + "米");
    }

    //测量结束调用事件
    function measureCompleted2(measureEventArgs) {
        var area = measureEventArgs.result.area,
            unit = measureEventArgs.result.unit;
        alert("量算结果:" + area + "平方米");
    }

    //移除图层要素
    // function clearFeatures() {
    //     lineLayer.removeAllFeatures();
    // }